﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="Phoenix.Service.Model" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Index
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<form id="form1" runat="server">
<div class="path">
        <strong>权限管理</strong>
    </div>
    <div class="pd10">
        <div class="mb10 aL">
          <a href="javascript:void(showEdit('','<%= ViewData["RightTypeID"] %>'))" title="添加权限" class="a-btn1">添加权限</a>
        </div>
          <span id="Grid">
<table class="tb-list hover">
    <tr>
        <th>
            权限ID
        </th>
        <th>
            权限Action
        </th>
		<th>
            显示名称
        </th>
         <th >
           创建时间
        </th>
         <th >
            更新时间
        </th>
         <th  style=" width:20%">
            操作
        </th>
    </tr>
    <%  IList<RightsModel> RightsList = ViewData["RightsList"] as List<RightsModel>; %>
    <%foreach (var item in RightsList) %> 
    <%{ %>
     <tr>
        <td >
           <%=item.RightID %>
        </td>
         <td >
           <%=item.RightName %>
        </td> 
		  <td >
           <%=item.RightDisplayName %>
        </td>         
        <td >
           <%=item.CreateTime.ToString() %>
        </td>
         <td >
           <%=item.UpdateTime.ToString()%>
        </td>
        <td style="width:20%">
           <a href="javascript:void(showEdit('<%=item.RightID %>','<%=item.RightTypeID %>'))">编辑</a> <a href="javascript:;" onclick="DeleteRight('<%=item.RightID %>')">删除</a>
        </td>
    </tr>
    <%} %>
</table>
        </span>
    </div>
    </form>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="HeadStyles" runat="server">
    <script type="text/javascript" src="/Scripts/m-lhgdialog/m-lhgdialog.js"></script>    
	<script type="text/javascript" src="/Scripts/library/m-pagination.js"></script>    
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="HeadScripts" runat="server">
        <script type="text/javascript" src="/Scripts/m-lhgdialog/m-lhgdialog.js"></script>    
	<script type="text/javascript" src="/Scripts/library/m-pagination.js"></script>    

</asp:Content>

<asp:Content ID="Content5" ContentPlaceHolderID="BodyScripts" runat="server">
    <script type="text/javascript">

    	// 删除类目
        function DeleteRight(rightID) {
    		if (confirm("确认删除吗?") == false) {
    			return;
    		}

    		$.ajax({
    		    url: "/Rights/Delete",
    		    data: { "rightID": rightID },
    			type: "POST",
    			success: function (data, textStatus) {
    				if (data.status === "warning" || data.status === "error") {
    					alert(data.msg);
    					return false;
    				}
    				// 刷新列表
    				refresh();
    			},
    			error: function (XmlHttpRequest, textStatus, errorThrown) {
    				alert(errorThrown);
    			}
    		});
    	};

    	// 显示编辑
    	function showEdit(rightID, rightTypeID) {
    	    OpenPop('/Rights/edit?rightID=' + rightID + '&rightTypeID=' + rightTypeID, "编辑权限", 500, 350);
    	};

    	//打开弹窗
    	function OpenPop(url, titleName, width, height) {
    		width = width || 800;
    		height = height || 500;
    		window.top.winObj = window;
    		window.top.oDG = new $.dialog({ id: 'esDialog', title: titleName, page: url, width: width, height: height, btnBar: false, lockScroll: true });
    		window.top.oDG.ShowDialog();
    	}
        
</script> 
</asp:Content>